<template>
    <div class="default-main ba-table-box">
        <el-alert class="ba-table-alert" v-if="baTable.table.remark" :title="baTable.table.remark" type="info" show-icon />

        <!-- 表格顶部菜单 -->
        <TableHeader
            :buttons="['refresh', 'add', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']"
            :quick-search-placeholder="t('Quick search placeholder', { fields: t('driver.settled.full_name') })"
        />

        <!-- 表格 -->
        <!-- 要使用`el-table`组件原有的属性，直接加在Table标签上即可 -->
        <Table ref="tableRef" />

    </div>
</template>

<script setup lang="ts">
import { ref, provide } from 'vue'
import baTableClass from '/@/utils/baTable'
import Table from '/@/components/table/index.vue'
import TableHeader from '/@/components/table/header/index.vue'
import { defaultOptButtons } from '/@/components/table'
import { baTableApi } from '/@/api/common'
import { useI18n } from 'vue-i18n'

defineOptions({
    name: 'driver/settled',
})
let optButtons: OptButton[] = [
    {
        render: 'tipButton',
        name: 'info',
        title: 'Info',
        text: '',
        type: 'primary',
        icon: 'fa fa-search-plus',
        class: 'table-row-info',
        disabledTip: false,
        click: (row: TableRow) => {},
    }
]
const { t } = useI18n()
const tableRef = ref()
const baTable = new baTableClass(
    new baTableApi('/admin/settled/'),
    {
        column: [
            { type: 'selection', align: 'center', operator: false },
            { label: t('driver.settled.full_name'), prop: 'full_name', align: 'center', operator: 'LIKE', operatorPlaceholder: t('full_name') },
            {
                label: t('driver.settled.phone_number'),
                prop: 'phone_number',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('phone_number'),
            },
            { label: t('driver.settled.full_idcard'), prop: 'full_idcard', align: 'center', operator: 'LIKE', operatorPlaceholder: t('full_idcard'),showOverflowTooltip:true },
            { label: t('driver.settled.full_email'), prop: 'full_email', align: 'center', operator: 'LIKE', operatorPlaceholder: t('full_email') },
            {
                label: t('driver.settled.vehicle_make'),
                prop: 'vehicle_make',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('vehicle_make'),
            },
            {
                label: t('driver.settled.vehicle_model'),
                prop: 'vehicle_model',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('vehicle_model'),
            },
            {
                label: t('driver.settled.vehicle_year'),
                prop: 'vehicle_year',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('vehicle_year'),
            },
            {
                label: t('driver.settled.vehicle_plate_number'),
                prop: 'vehicle_plate_number',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('vehicle_plate_number'),
            },
            {
                label: t('driver.settled.license_number'),
                prop: 'license_number',
                align: 'center',
                operator: 'LIKE',
                operatorPlaceholder: t('license_number'),
            },
            {
                label: t('Operate'),
                align: 'center',
                width: 120,
                render: 'buttons',
                buttons: optButtons,
                operator: false,
            },
        ],
        dblClickNotEditColumn: [undefined],
    },
    {
        defaultItems: {
            type: 'reduction',
            usage_limit: '0',
            status: 'valid',
        },
    }
)

baTable.mount()
baTable.getIndex()

provide('baTable', baTable)
</script>

<style scoped lang="scss"></style>
